//
// Created by yu on 2023/11/8.
//
#pragma once
#include "CANFrame.h"

class miMotor
{
 public:
  struct miReturnData
  {
    uint8_t id;
    double torque;            /// Nm
    uint16_t angle;             /// degree
    double angularVelocity;   /// degree/s
  }leftMi,rightMi;

  miReturnData Motor1 = {1, 0, 0, 0};
  miReturnData Motor2 = {2, 0, 0, 0};

////  电机运行
  void motorRun(uint8_t id);
////  电机停止
  void motorStop(uint8_t id);

///   运控模式
  void runControl(uint8_t id, float torque, uint16_t angle, float angularVelocity);
///   位控模式
  void positionControl(uint8_t id, float speedLim, int position);
///   位置读取
  int readAngle(uint8_t id);

} inline miMotor;

